<template>
  <!-- 子平台系统 -->
  <div class="subplatform">
    <cMenu :isCollapse="isCollapse" :plat_setting="plat_setting" v-if="isShow"></cMenu>
    <div style="width: 100%;">
      <cNavbar @collapseEvevt="isCollapse = !isCollapse" :member="member" v-if="isShow"></cNavbar>
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
  import {cMenu,cNavbar} from './components';
  import { Message} from "element-ui";
  import http from './js/http.js'
  Vue.prototype.$message = Message;
  export default {
    components: { cMenu , cNavbar},
    data() {
      return {
        isCollapse: false,
        member: {},
        plat_setting: {},
        isShow: false
      };
    },
    mounted() {
      this.getUserData();
    },
    methods: {
      // 获取头部信息
      async getUserData() {
        try {
          let {data,result,msg} =  await http.get("plugin.sub-platform.frontend.index.common-data",{});
          if(result) {
            this.member = data.member;
            this.plat_setting = data.plat_setting;
            this.isShow = true;
          }else {
            this.$message.error(msg);
            this.isShow = true;
          }
        } catch ({data,result,msg}) {
          // this.$message.error(msg);
          this.isShow = true;
          console.log(msg);
        }
      },
    }
  };
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
.subplatform {
  background: #fafafa;
  height: 100vh;
  display: flex;
}
</style>
